package com.huawei.appmarket.service.appdetail.view.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.viewpager.widget.ViewPager.OnPageChangeListener;
import com.huawei.appgallery.serverreqkit.api.bean.startup.StartupResponse.TabInfo;
import o.Logger;
import o.drx;
import o.ewm.c;
import o.ewm.e;

public class MutilRowNavigator extends LinearLayout implements OnClickListener, OnPageChangeListener {
    private Context ˊ;
    private drx ˋ;
    private TextView ˎ;
    private int ˏ = 0;
    private int ॱ = 0;

    public MutilRowNavigator(Context context) {
        super(context);
        ॱ(context);
    }

    public MutilRowNavigator(Context context, AttributeSet attributeSet) {
        super(context, attributeSet);
        ॱ(context);
    }

    private void ॱ(Context context) {
        this.ˊ = context;
        this.ॱ = this.ˊ.getResources().getColor(c.ॱˎ);
        this.ˏ = this.ˊ.getResources().getColor(c.ʼ);
    }

    private void ˏ(TextView textView, boolean z) {
        if (z) {
            textView.setTextColor(this.ॱ);
            textView.setBackgroundResource(e.ͺ);
            return;
        }
        textView.setTextColor(this.ˏ);
        textView.setBackgroundResource(e.ॱˊ);
    }

    public void setMuiltRowNavigatorClickListener(drx o_drx) {
        this.ˋ = o_drx;
    }

    public void onClick(View view) {
        ˎ(view);
        if (view != null) {
            Object tag = view.getTag();
            if (this.ˋ != null && (tag instanceof TabInfo)) {
                this.ˋ.ॱ(((TabInfo) tag).ˏ());
            }
        }
    }

    private void ˎ(View view) {
        if (view == null) {
            Logger.ˋ("MutilRowNavigator", "setSelected error:view is null");
        } else if ((view instanceof TextView) && view != this.ˎ) {
            TextView textView = (TextView) view;
            if (this.ˎ != null) {
                ˏ(this.ˎ, false);
            }
            ˏ(textView, true);
            this.ˎ = textView;
        }
    }

    public void onPageScrolled(int i, float f, int i2) {
    }

    public void onPageScrollStateChanged(int i) {
        View childAt = getChildAt(0);
        if (childAt != null && (childAt instanceof LinearLayout)) {
            ˎ(((LinearLayout) childAt).getChildAt(i));
        }
    }

    public void onPageScrolled(int i) {
    }
}
